package Test;


import com.config.MyBatisConfig;
import com.config.SpringConfig;
import com.domain.User;
import com.mapper.UserMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes={SpringConfig.class, MyBatisConfig.class})
public class UserMapperTest {
    @Autowired
    UserMapper userMapper;

    @Test
    public void findByIdTest(){
        System.out.println(userMapper.findById(1));
        System.out.println(userMapper.findById(1).getName());
        System.out.println(userMapper.findById(1).getRole());
    }

     @Test
    public void checkEmailTest(){
        System.out.println(userMapper.checkEmail("1"));
    }

    @Test
    public void checkNameTest(){
        System.out.println(userMapper.checkName("admin"));
    }

}
